import React, { Component } from "react";
// import 'katex/dist/katex.min.css';

class AlgorithmHelper extends Component{
  constructor(props){
    super(props);

    this.init   = this.init.bind(this);
    this.reset  = this.reset.bind(this);
  }

  init(){
    if(this.props.algorithmImp){
      this.props.algorithmImp.init();
    }
  }

  reset(){
    if(this.props.algorithmImp){
      this.props.algorithmImp.reset();
    }
  }

  render(){
    return (
      <div className="body">

        <div className="title">{this.props.algorithm?this.props.algorithm.name:''}</div>
        <div className="head"><label>算法描述</label></div>
        <div id='description'>...</div>

        <div className="head"> 
          <label>模型</label> 
          <button hidden={!this.props.algorithmImp} onClick={this.reset}>重置</button>
          <button hidden={!this.props.algorithmImp} onClick={this.init}>刷新</button>
        </div>
        <div id='model'>...</div>

        <div className="head"> <label>输入</label> </div>
        <div id='input'>...</div>

        <div className="head"> <label>输出</label>  </div>
        <div id='output'>...</div>

        <div className="head">  <label>测试</label>  </div>
        <div id='test'>...</div>
      </div>
    )
  }
}

export default AlgorithmHelper;